#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include "util.h"
#include "genpasswd.h"
#include "cracker.h"

#define	AES_IV			0

int
main(int argc, char **argv) {
	User **users;
	int count, i;
	
	if (argc != 3) {
		printf("Usage: %s <keys file> <spy file>\n", argv[0]);
		exit(1);
	}
	users = readUsers(argv[1], &count);

	if (!crack(argv[2], users, count))
		printf("Couldn't crack the file... Try with a better dictionary!\n");
	else
		printf("File cracked!\n");
	for(i=0; i<count; i++)
		free(users[i]);
	free(users);
	
	return EXIT_SUCCESS;
}
